home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / business / cmplusb.zip / CMPLUS2.LZH / _PS.PRO < prev    next >
Text File  |  1993-06-22  |  18KB  |  616 lines

  1. %%DocumentFonts: (atend)
  2. %%Creator: GRAF/DRIVE PLUS
  3. %%EndComments
  4.  
  5. %* GRAF/DRIVE PLUS Copyright (C) 1990-91  M.K. Fleming  All Rights Reserved
  6.  
  7. % -------------------------- VARIABLE LIST --------------------------------
  8. %
  9. % PERMANENT DEFINITIONS:
  10. % StdLine                         1-unit line width in decipoints
  11. %
  12. % CURRENT STATUS INFO:
  13. % CurFont                         current font
  14. % TxtDir                          text direction (0=horizontal, 1=vertical)
  15. % TxtHt                           text height
  16. % FillColor                       filling color
  17. % DrawColor                       drawing color
  18. % AuxColor                        fill interior color
  19. % FillStyle                       fill pattern id
  20. % LineWidth                       line width (as multiple of StdLine)
  21. % LineStyle                       line pattern
  22. % UserPat                         user-defined fill pattern
  23. % ptm                             pattern matrix
  24. %
  25. %
  26. % TEMPORARY, WORKING VALUES:
  27. % x1,y1,x2,y2                     rectangle coordinates
  28. % top,dep,ydep,h,w                3-D bar values
  29. % px1,py1,py2,pw,PatChar          pattern fill data
  30. % savematrix                      temporary storage
  31. %
  32. % -------------------------------------------------------------------------
  33.  
  34. /GrafDrivDict 100 dict def
  35. /ReEncodeDict 12 dict def
  36. GrafDrivDict begin
  37.  
  38. % ---------------------- PERMANENT DEFINITIONS ----------------------------
  39. /StdLine 2 def     % Normal line width, in decipoints
  40. /Thick   8 def     % Thick line width, as multiple of StdLine
  41.  
  42. /CharSet
  43. [
  44.     10#128   /Ccedilla
  45.     10#129   /udieresis
  46.     10#130   /eacute
  47.     10#131   /acircumflex
  48.     10#132   /adieresis
  49.     10#133   /agrave
  50.     10#134   /aring
  51.     10#135   /ccedilla
  52.     10#136   /ecircumflex
  53.     10#137   /edieresis
  54.     10#138   /egrave
  55.     10#139   /idieresis
  56.     10#140   /icircumflex
  57.     10#141   /igrave
  58.     10#142   /Adieresis
  59.     10#143   /Aring
  60.     10#144   /Eacute
  61.     10#145   /ae
  62.     10#146   /AE
  63.     10#147   /ocircumflex
  64.     10#148   /odieresis
  65.     10#149   /ograve
  66.     10#150   /ucircumflex
  67.     10#151   /ugrave
  68.     10#152   /ydieresis
  69.     10#153   /Odieresis
  70.     10#154   /Udieresis
  71.     10#155   /cent
  72.     10#156   /sterling
  73.     10#157   /yen
  74.     10#158   /P
  75.     10#159   /florin
  76.     10#160   /aacute
  77.     10#161   /iacute
  78.     10#162   /oacute
  79.     10#163   /uacute
  80.     10#164   /ntilde
  81.     10#165   /Ntilde
  82.     10#166   /ordfeminine
  83.     10#167   /ordmasculine
  84.     10#168   /questiondown
  85. ] def
  86.  
  87. % --------------------------------------------------------------------
  88. % OldName NewName AF      Encode font OldName to NewName
  89. % --------------------------------------------------------------------
  90. /AF
  91. {
  92. ReEncodeDict begin
  93.     /NewName exch def  /OldName exch def
  94.     FontDirectory NewName known not
  95.     {
  96.         FontDirectory OldName known not { /OldName /Courier def } if
  97.         /BaseFontDict OldName findfont def
  98.         /NewFontDict BaseFontDict maxlength dict def
  99.         BaseFontDict
  100.         {
  101.             exch dup /FID ne
  102.             {
  103.                 dup /Encoding eq
  104.                 {
  105.                     exch dup length array copy
  106.                     NewFontDict 3 1 roll put
  107.                 }
  108.                 {
  109.                     exch NewFontDict 3 1 roll put
  110.                 }
  111.                 ifelse
  112.             }
  113.             {
  114.                 pop pop
  115.             }
  116.             ifelse
  117.         } forall
  118.  
  119.         NewFontDict /FontName NewName put
  120.  
  121.         CharSet aload
  122.         length 2 idiv
  123.         {
  124.             NewFontDict /Encoding get 3 1 roll put
  125.         }
  126.         repeat
  127.  
  128.         NewName NewFontDict definefont pop
  129.     } if
  130. end
  131. } bind def
  132.  
  133.  
  134. % ---------------------------------------------------------------------------
  135. %                           PATTERN FILLS
  136. % ---------------------------------------------------------------------------
  137. /newfont 10 dict def
  138. newfont begin
  139.  
  140. /FontType 3 def
  141. /FontMatrix [ 1 0 0 1 0 0 ] def
  142. /FontBBox [ 0 0 8 8 ] def
  143. /Encoding 256 array def
  144.   0 1 255 { Encoding exch /.notdef put } for
  145.   Encoding  99 /linefill  put      % c=2
  146.   Encoding 100 /ltslash   put      % d=3
  147.   Encoding 101 /slash     put      % e=4
  148.   Encoding 102 /bkslash   put      % f=5
  149.   Encoding 103 /ltbkslash put      % g=6
  150.   Encoding 104 /hatch     put      % h=7
  151.   Encoding 105 /xhatch    put      % i=8
  152.   Encoding 106 /interleav put      % j=9
  153.   Encoding 107 /widedot   put      % k=10
  154.   Encoding 108 /closedot  put      % l=11
  155.   Encoding 122 /userfill  put      % z=12
  156.  
  157.  
  158. /CharProcs 16 dict def
  159. CharProcs begin
  160. /.notdef {} bind def
  161. /linefill  { 8 8 true [1 0 0 -1 0 8] { <ffff0000ffff0000> } imagemask } bind def
  162. /ltslash   { 8 8 true [1 0 0 -1 0 8] { <0102040810204080> } imagemask } bind def
  163. /slash     { 8 8 true [1 0 0 -1 0 8] { <e0c183070e1c3870> } imagemask } bind def
  164. /bkslash   { 8 8 true [1 0 0 -1 0 8] { <f0783c1e0f87c3e1> } imagemask } bind def
  165. /ltbkslash { 8 8 true [1 0 0 -1 0 8] { <a5d269b45a2d964b> } imagemask } bind def
  166. /hatch     { 8 8 true [1 0 0 -1 0 8] { <ff888888ff888888> } imagemask } bind def
  167. /xhatch    { 8 8 true [1 0 0 -1 0 8] { <8142241818244281> } imagemask } bind def
  168. /interleav { 8 8 true [1 0 0 -1 0 8] { <cc33cc33cc33cc33> } imagemask } bind def
  169. /widedot   { 8 8 true [1 0 0 -1 0 8] { <8000080080000800> } imagemask } bind def
  170. /closedot  { 8 8 true [1 0 0 -1 0 8] { <8800220088002200> } imagemask } bind def
  171. /userfill  { 8 8 true [1 0 0 -1 0 8] { UserPat            } imagemask } bind def
  172. end
  173.  
  174. /BuildChar       % fontdic charcode BuildChar
  175. {
  176.     exch begin
  177.         dup  122 eq
  178.         {
  179.             8 0 setcharwidth
  180.         }{
  181.             8 0   0 0 8 8  setcachedevice
  182.         } ifelse
  183.         Encoding exch get
  184.         CharProcs exch get
  185.     end
  186.     exec
  187. } bind def
  188. end % of newfont
  189. /PatFont newfont definefont pop
  190.  
  191. /UserPat <0001020400402010>  def
  192. /PatChar (a) def
  193.  
  194. /patfill
  195. {
  196.     gsave
  197.     eoclip
  198.     gsave AuxColor CS fill grestore
  199.     ptm setmatrix /PatFont findfont 1 scalefont setfont
  200.     PatChar 0 FillStyle 97 add put
  201.  
  202.     pathbbox newpath
  203.     4 2 roll
  204.     cvi 3 not and /py1 exch def
  205.     cvi 3 not and /px1 exch def
  206.     /py2 exch def
  207.     px1 sub 8 div ceiling cvi /pw exch def
  208.  
  209.     py1 8 py2
  210.     {
  211.         px1 exch moveto
  212.         pw { PatChar show } repeat
  213.     } for
  214.  
  215.     grestore
  216. } bind def
  217.  
  218. % ---------------------------------------------------------------------------
  219.  
  220.  
  221.  
  222. /xround
  223. {
  224.     dup round dup 0 eq
  225.     {
  226.         2 -1 roll 0 lt { -1 } { 1 } ifelse
  227.     }if
  228.     2 -1 roll pop
  229. } bind def
  230.  
  231. /roundup
  232. {
  233.     dup 0 lt {floor} {ceiling} ifelse
  234. } bind def
  235.  
  236. /N { newpath } bind def
  237. /M { moveto } bind def
  238. /L { lineto } bind def
  239. /C { closepath } bind def
  240.  
  241.  
  242. % ----------------------------------------------------------------------
  243. % x1 y1 x2 y2       REC    draw rectangle (x1,y1)-(x2,y2)
  244. % ----------------------------------------------------------------------
  245. /REC
  246. {
  247.     transform round exch round exch itransform 4 2 roll
  248.     transform round exch round exch itransform 4 2 roll
  249.     /y2 exch def  /x2 exch def  /y1 exch def  /x1 exch def
  250.     newpath
  251.     x1 y1 moveto
  252.     x2 y1 lineto
  253.     x2 y2 lineto
  254.     x1 y2 lineto
  255.     closepath
  256. } bind def
  257.  
  258. % ----------------------------------------------------------------------
  259. %                   SK     stroke the current path
  260. % ----------------------------------------------------------------------
  261. /SK
  262. {
  263.     gsave DrawColor CS stroke grestore newpath
  264. } bind def
  265.  
  266. % ----------------------------------------------------------------------
  267. %                   FILL   fill the current path
  268. % ----------------------------------------------------------------------
  269. /FILL
  270. {
  271.     gsave
  272.     FillStyle 0 eq { AuxColor CS } { FillColor CS } ifelse
  273.     FillStyle 1 le { eoclip fill } { patfill } ifelse
  274.     grestore
  275. } bind def
  276.  
  277. % ----------------------------------------------------------------------
  278. % x1 y1 x2 y2       VEC    draw line from (x1,y1) to (x2,y2)
  279. % ----------------------------------------------------------------------
  280. /VEC
  281. {
  282.     transform round exch round exch itransform 4 2 roll
  283.     transform round exch round exch itransform 4 2 roll
  284.     newpath moveto lineto SK
  285. } bind def
  286.  
  287. % ----------------------------------------------------------------------
  288. % x1 y1             VS     start path
  289. % ----------------------------------------------------------------------
  290. /VS
  291. {
  292.     transform round exch round exch itransform
  293.     newpath moveto
  294. } bind def
  295.  
  296. % ----------------------------------------------------------------------
  297. % x  y              VR     close/continue path
  298. % ----------------------------------------------------------------------
  299. /VR
  300. {
  301.     transform round exch round exch itransform
  302.     closepath moveto
  303. } bind def
  304.  
  305. % ----------------------------------------------------------------------
  306. % x  y              VC     continue path
  307. % ----------------------------------------------------------------------
  308. /VC
  309. {
  310.     transform round exch round exch itransform
  311.     lineto
  312. } bind def
  313.  
  314. % ----------------------------------------------------------------------
  315. % x  y  c           PX     simulated putpixel
  316. % ----------------------------------------------------------------------
  317. /PX
  318. {
  319.     gsave
  320.     newpath CS 2 setlinewidth [] 0 setdash
  321.     transform round exch round exch itransform moveto
  322.     -1 0 rmoveto 1 0 rlineto stroke
  323.     grestore
  324. } bind def
  325.  
  326. % ----------------------------------------------------------------------
  327. % x1 y1 x2 y2 d t   BAR    fill and outline rectangle (x1,y1)-(x2,y2)
  328. % ----------------------------------------------------------------------
  329. /BAR
  330. {
  331.     /top exch def /dep exch def
  332.     REC FILL
  333.     newpath
  334.     x2 y1 moveto
  335.     x1 y1 lineto
  336.     x1 y2 lineto
  337.     x2 y2 lineto
  338.     x2 y1 lineto
  339.     dep 0 ne { BARDEP } if
  340.     SK
  341. } bind def
  342.  
  343. /BARDEP
  344. {
  345.     dep .6 mul /ydep exch def
  346.     y2 y1 sub /h exch def
  347.     x2 x1 sub /w exch def
  348.     dep ydep rlineto
  349.     0 h rlineto
  350.     top 0 ne { BARTOP } if
  351. } bind def
  352.  
  353. /BARTOP
  354. {
  355.     w neg 0 rlineto
  356.     dep neg ydep neg rlineto
  357.     w 0 rlineto
  358.     dep ydep rlineto
  359.     0 h neg rlineto
  360.     closepath
  361. } bind def
  362.  
  363. % ----------------------------------------------------------------------
  364. % x1 y1 x2 y2       PBR    fill rectangle (x1,y1)-(x2,y2)
  365. % ----------------------------------------------------------------------
  366. /PBR
  367. {
  368.     REC FILL
  369. } bind def
  370.  
  371. % ----------------------------------------------------------------------
  372. % xc yc th1 th2 a b EPATH  elliptical path
  373. % ----------------------------------------------------------------------
  374. /EPATH
  375. {
  376.     /savematrix matrix currentmatrix def
  377.     6 -2 roll translate scale
  378.     0 0 1 5 -2 roll arc
  379.     savematrix setmatrix
  380. } bind def
  381.  
  382. % ----------------------------------------------------------------------
  383. % xc yc th1 th2 a b ARC    draw an elliptical arc
  384. % ----------------------------------------------------------------------
  385. /ARC
  386. {
  387.     gsave
  388.     newpath EPATH [] 0 setdash SK
  389.     grestore
  390. } bind def
  391.  
  392. % ----------------------------------------------------------------------
  393. % xc yc th1 th2 a b PIE    draw and fill an elliptical pieslice
  394. % ----------------------------------------------------------------------
  395. /PIE
  396. {
  397.     gsave
  398.     newpath
  399.     6 -2 roll 2 copy moveto 6 2 roll
  400.     EPATH closepath FILL SK
  401.     grestore
  402. } bind def
  403.  
  404. % ----------------------------------------------------------------------
  405. % xc yc a b         ELI    draw and fill an ellipse
  406. % ----------------------------------------------------------------------
  407. /ELI
  408. {
  409.     4 2 roll 0 360 6 -2 roll
  410.     gsave
  411.     newpath EPATH FILL SK
  412.     grestore
  413. } bind def
  414.  
  415. % ----------------------------------------------------------------------
  416. % x y dx dy (text)  TXT    draw text at x,y
  417. % ----------------------------------------------------------------------
  418. /TXT
  419. {
  420.     gsave
  421.     DrawColor CS
  422.     5 -2 roll translate TxtDir 0 ne { 90 rotate } if
  423.     3 1 roll MoveChar mul 2 div
  424.     exch 2 index stringwidth pop mul 2 div
  425.     exch moveto show
  426.     grestore
  427. } bind def
  428.  
  429. % ----------------------------------------------------------------------
  430. % size dir font   TXS     sets text size
  431. % ----------------------------------------------------------------------
  432. /TXS
  433. {
  434.     /CurFont exch def /TxtDir exch def  /TxtHt exch def
  435.     CurFont findfont TxtHt scalefont setfont
  436.     /MoveChar TxtHt def
  437. %   newpath 0 0 moveto
  438. %   (0|h) false charpath flattenpath pathbbox newpath
  439. %   /MoveChar exch def 3 { pop } repeat
  440. } bind def
  441.  
  442. % ----------------------------------------------------------------------
  443. % array             LD      defines line style
  444. % ----------------------------------------------------------------------
  445. /LD
  446. {
  447.     dup /LineStyle exch def 0 setdash
  448. } bind def
  449.  
  450.  
  451. % ----------------------------------------------------------------------
  452. % draw              DC      defines draw color
  453. % fill              FC      defines fill color
  454. % aux               AC      defines auxiliary color
  455. % ----------------------------------------------------------------------
  456. /DC { /DrawColor exch def } bind def
  457. /FC { /FillColor exch def } bind def
  458. /AC { /AuxColor  exch def } bind def
  459.  
  460. % ----------------------------------------------------------------------
  461. % pat#              FD      defines fill pattern
  462. % ----------------------------------------------------------------------
  463. /FD
  464. {
  465.     /FillStyle exch def
  466. } bind def
  467.  
  468. % ----------------------------------------------------------------------
  469. % patstr            FPD     defines user fill
  470. % ----------------------------------------------------------------------
  471. /FPD
  472. {
  473.     /UserPat exch def  /FillStyle 25 def
  474. } bind def
  475.  
  476. % ----------------------------------------------------------------------
  477. % color             CS      select  color
  478. % ----------------------------------------------------------------------
  479. /CS
  480. {
  481.     dup type /arraytype ne { setgray }{ {} forall setrgbcolor } ifelse
  482. } bind def
  483.  
  484. % ----------------------------------------------------------------------
  485. % x1 y1 x2 y2       CLIP   set clipping region
  486. % ----------------------------------------------------------------------
  487. /CLIP
  488. {
  489.     transform round exch round exch itransform 4 2 roll
  490.     transform round exch round exch itransform 4 2 roll
  491.     grestore gsave   % reset to INXX state
  492.     0 setlinewidth REC eoclip newpath
  493.     % restore current graphics state
  494.     TxtHt TxtDir CurFont TXS
  495.     LineWidth setlinewidth
  496.     LineStyle 0 setdash
  497. } bind def
  498.  
  499.  
  500. % ----------------------------------------------------------------------
  501. % no                LW      set line width
  502. % ----------------------------------------------------------------------
  503. /LW
  504. {
  505.     StdLine mul dup /LineWidth exch def setlinewidth
  506. } bind def
  507.  
  508. % ----------------------------------------------------------------------
  509. % Width Height Orient Left Top     INXX    Initialize Page
  510. % Orient: 0=portrait, 1=landscape
  511. % ----------------------------------------------------------------------
  512. /INXX
  513. {
  514.     /PGstate save def
  515.     /ptm
  516.     [
  517.         0.5 0.5 matrix defaultmatrix dtransform xround exch xround exch
  518.         0 exch 0 exch 0 0
  519.     ] def
  520.     2 index 0 ne   % if landscape
  521.     {
  522.         /ptm
  523.         [
  524.             ptm aload pop 6 2 roll 4 2 roll neg exch neg exch 6 -2 roll
  525.         ] def
  526.     }
  527.     if
  528.  
  529.     0.1 0.1 scale translate
  530.  
  531.     0 eq
  532.     { neg 0 exch translate pop }                % portrait
  533.     { 90 rotate neg exch neg exch translate }   % landscape
  534.     ifelse
  535.  
  536.     /StdLine
  537.     StdLine dup dtransform roundup exch roundup exch idtransform pop
  538.     def
  539.  
  540.     /Courier /CourierGD AF
  541.     120 0 /CourierGD TXS
  542.     0 FC 0 DC 1 AC 1 FD 1 LW [] LD 1.415 setmiterlimit
  543.     gsave
  544. } bind def
  545.  
  546. % ----------------------------------------------------------------------
  547. %                   TERM    Display Page
  548. % ----------------------------------------------------------------------
  549. /TERM
  550. {
  551.     showpage
  552.     PGstate restore
  553. } bind def
  554.  
  555.  
  556. % ----------------------------------------------------------------------
  557. % ulx uly width height imagecols imagerows CI  hexdata      ;Color Image
  558. % ----------------------------------------------------------------------
  559. /CI
  560. {
  561.     gsave
  562.     /rows exch def /cols exch def
  563.     4 2 roll translate scale
  564.     /picstr cols string def
  565.  
  566.     cols rows 8
  567.     [ cols 0 0 rows neg 0 0 ]
  568.     { currentfile picstr readhexstring pop }
  569.     false 3 colorimage
  570.     grestore
  571. } bind def
  572.  
  573.  
  574. % ----------------------------------------------------------------------
  575. % ulx uly width height imagecols imagerows bits GI  hexdata ;GrayScale Image
  576. % ----------------------------------------------------------------------
  577. /GI
  578. {
  579.     gsave
  580.     /bits exch def /rows exch def /cols exch def
  581.     4 2 roll translate scale
  582.     /picstr cols bits mul 7 add 8 idiv string def
  583.  
  584.     cols rows bits
  585.     [ cols 0 0 rows neg 0 0 ]
  586.     { currentfile picstr readhexstring pop }
  587.     image
  588.     grestore
  589. } bind def
  590.  
  591.  
  592. % ................ INSERT ANY USER PROCS HERE ........................
  593. %  Always use gsave/grestore around user proc code
  594.  
  595. % This is an example of a User Proc to display text rotated to any
  596. % angle.  It does not work for stroked fonts, only for DEFAULT_FONT
  597. % and PostScript fonts
  598.  
  599. /ROT                      %    x y (text) angle ROT
  600. {
  601.     gsave
  602.     DrawColor CS          % select the drawing color
  603.     4 -2 roll translate   % move the origin to (x,y)
  604.     rotate                % rotate to angle
  605.                           % compute coords to center vertically
  606.     0 0 moveto (X) false charpath flattenpath pathbbox newpath
  607.     2 index add -2 div 0 exch moveto pop pop pop
  608.     show
  609.     grestore
  610. } bind def
  611.  
  612. % ....................................................................
  613.  
  614. %%EndProlog
  615.  
  616.